(function() {
	var $admin = $("#admin");
	
	$('button.search', $admin).click(function(){
		var $coreWordInput = $('input:text', $admin);
		var coreWord = $coreWordInput.val();
		$.ajax({
			url: "search",
			data: {coreWord: coreWord},
			type: 'POST',
			success: function(data){
				$('div.result', $admin).html(data);
			}
		});
		return false;
	});
	
	$( "button.update-categories", $admin ).click(function(){
		$.ajax({
			url: 'update-categories',
			success: function(){
				alert('ok');
			}
		});
		return false;
	});
	
	$( "button.import", $admin ).click(function(){
		$.ajax({
			url: 'import',
			success: function(){
				alert('ok');
			}
		});
		return false;
	});
})();
